package com.huawei.hwclouds.lubanops.demo.common.constants;

import java.nio.charset.Charset;

/**
 * 包含系统常量值的类
 */
public class Constants {

    /**
     * 采集状态
     */
    public final static int COLLECT_STATUS_OK = 0;

    public final static int COLLECT_STATUS_PENDING = 1;

    public final static int COLLECT_STATUS_ERROR = 2;

    /**
     * 十分钟心跳不上来就算是离线，正常应该一分钟，但是有可能用户在发布，所以时间放长一些
     */
    public static final int INSTANCE_OFFLINE_OFFSET_IN_MINUTES = 5;

    public static final long INSTANCE_OFFLINE_OFFSET_IN_SECONDS = INSTANCE_OFFLINE_OFFSET_IN_MINUTES * 60;

    /**
     * 计费资源类型
     */
    public final static String CLOUD_SERVICE_TYPE = "hws.service.type.apm";

    public final static String ACCUMULATE_FACTOR = "apm2.instance";

    public final static String RESOURCE_TYPE = "hws.resource.type.apm2.instance";

    public final static String RESOURCE_SPEC_CODE_NORMAL = "apm2.instance.normal";

    public final static String RESOURCE_SPEC_CODE_TRIAL = "apm2.instance.trial";

    /**
     * 租户购买的资源状态
     */
    public static final String NORMAL_STATUS = "0";// 正常

    public static final String FREEZE_STATUS = "1";// 冻结（资源保留）

    public static final String STOP_STATUS = "2";// 终止

    public static final String LIMITED_STATUS = "3"; // 受限状态。UDS控制用户桶访问权限

    public static final int SUCCESS_EVENT = 0;// 成功处理事件

    public static final int FAILD_EVENT = 1;// 失败处理事件

    public static final int EVENT_TYPE_NEW = 1;//

    public static final int EVENT_TYPE_CHANGE = 2;//

    public static final int EVENT_TYPE_DELETE = 3;//

    public static final int EVENT_TYPE_FREEZE = 4;//

    public static final int EVENT_TYPE_UNFREEZE = 5;//

    public static final int EVENT_TYPE_SWITCH = 6;//

    public static final int EVENT_TYPE_RES_CHANGE = 7;//

    /**
     * 免费体验版资源消耗参数
     */
    public static final int TRIAL_ORIGINAL_AMOUNT = 24 * 10 * 7;

    public static final String TRIAL_MEASUREMENT = "Agent * Hour";

    public static final int TRIAL_NORMAL_STATUS = 0;

    public static final int TRIAL_FREEZE_STATUS = 1;

    /**
     * cmdb常量
     */
    public final static String CMDB_BUSINESS_DEFAULT_NAME = "default";

    /**
     * 一个业务下面允许创建的最大子业务的个数
     */
    public final static int MAX_BUSINESS_COUNT_PER_DOMAIN = 100;

    /**
     * 一个业务允许的最大的子业务的个数
     */
    public final static int MAX_SUB_BUSINESS_COUNT = 200;

    /**
     * 一个业务允许创建的最大的应用数量
     */
    public final static int MAX_APPLICATION_COUNT = 1000;

    /**
     * 一个业务允许创建的最大的环境的数量
     */
    public final static int MAX_ENV_COUNT_PER_BUSINESS = 5000;

    /**
     * 字符集
     */
    public final static String DEFAULT_ENCODING = "UTF-8";

    public final static Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

    /**
     * 系统支持的最大的消息长度，当前是1M
     */
    public final static int MAX_MESSAGE_LENGTH = 1024 * 1024;

    /**
     * 错误码的前缀 ,错误码格式 apm2.00000001 ,我们系统前缀默认apm2
     */
    public final static String ERROR_CODE_PREFIX = "apm2.";

    /**
     * content-type
     */
    public static final String CONTENT_TYPE_APP_JSON = "application/json; charset=utf-8";

}
